// import { ExtensionDecoderType, ExtensionEncoderType } from "@msgpack/msgpack";
// import { Encoder, Decoder, ExtensionCodec } from "@msgpack/msgpack/dist.es5+esm/index.mjs";
// import { SocketDecodeData, SocketProtoCoder } from "../../../sgame/Socket/ISocket";

// /**
//  * 使用msgpack来做数据的序列化
//  */
// class MsgpackProtoHandler<ContextType = undefined> extends SocketProtoCoder {
//     private _encoder: Encoder;
//     private _decoder: Decoder;
//     private _codec: ExtensionCodec;

//     register(register: {
//         type: number;
//         encode: ExtensionEncoderType<ContextType>;
//         decode: ExtensionDecoderType<ContextType>;
//     }): void {
//         this._codec.register(register);
//     }

//     constructor() {
//         super();
//         this._encoder = new Encoder();
//         this._codec = new ExtensionCodec();
//     }

//     encode(protoId: number, ...data: any[]): Uint8Array {
//         return this._encoder.encode([protoId, ...data], {
//             extensionCodec: this._codec,
//         });
//     }

//     decode(data: Uint8Array): SocketDecodeData {
//         return this._decoder.decode(data, {
//             extensionCodec: this._codec
//         }) as SocketDecodeData;
//     }
// }

// // 单例
// const msgpackProtoHandler = new MsgpackProtoHandler();
// // 其他需要的修改
// export { msgpackProtoHandler, MsgpackProtoHandler }